const HB = require("./inc/baseHb");
const STATE = require("../states/gunstates"); 
cc.Class({
    extends: HB,

    properties: {

    },

    onLoad(){
        this.setAttr("_gunStateV" , STATE.INBIGHEBING );
    },

    resetGunpos(){
        if(!this._gun) return;
        this._gun.node.active = true;
        cc.tween( this._gun.node)
        .to(.08 , 
            { position: (()=>{
                const thispos = this.node.parent.convertToWorldSpaceAR(this.node.getPosition());
                let topos = this._gun.node.parent.convertToNodeSpaceAR(thispos);
                topos = topos.sub(cc.v2(0, this._gun.node.height/2));
                return topos;
              })(), 
              scale : 1.2 , 
              rotation:0
        })
        .call(()=>{
            this._gun.flymodel( true );
        })
        .start();
        //this._gun.node.setPosition( this._gun.node.parent.convertToNodeSpaceAR(thispos) );
    }
});
